/** 
 * 删除中间表中的WTChangeOrder2
 */
package ext.generic.integration.oa.service;

import wt.change2.WTChangeOrder2;
import wt.fc.WTObject;

import com.infoengine.object.factory.Group;

import ext.generic.integration.oa.task.ECNIETask;

public class DeleteECNIEService {
	
	/**
	 * 删除中间表中指定ECN的数据
	 * @param wtObject
	 */
	public static void deleteECNMethod( WTObject wtObject ){
		if( wtObject != null && wtObject instanceof WTChangeOrder2 ){
			WTChangeOrder2 ecn = ( WTChangeOrder2 )wtObject;
			Group group = query(ecn);
			
			if( group != null && group.getElementCount() != 0 ){
				ECNIETask.delete(ecn);
			}
		}
	}
	
	/**
	 * 根据指定ecn从中间表中查询相关数据
	 * @param ecn
	 * @return
	 */
	private static Group query(WTChangeOrder2 ecn) {
		Group group = new Group();
		
		if( ecn == null ){
			return group;
		}
		
		group = ECNIETask.query(ecn);
		
		return group;
	}
}
